#pragma once
#include "RoomBase.h"

class RoomStd : public RoomBase {
    private:
        const static int TEAM_REQUIREMENT = 2; // number of teams required in the room

        vector<PF_List> pfLists; // PF_List for each match

        vector<RoomState> getOriginalStateQueue() const; // Get the original state queue for the room
        vector<int>getOriginalStateOpTeamIndex() const; // Get the original state team index for the room

    public:
        RoomStd(int id) : RoomBase(id) {
            matchCount = 5; // number of matches in the room
            curRound=1; // initialize current round number

            // initialize the PF_List for each match
            PF_List originalPFList;
            PF_List::getOriginalPFListCopy(originalPFList);

            pfLists.resize(matchCount, originalPFList);

            // initialize the state manager for the room
            stateManager = new RoomStateManager(id, getOriginalStateQueue(),getOriginalStateOpTeamIndex());

            // initialize the  team ID
            teamIDs.resize(2,-1);
        };


        // Get the PF_List for a specific match index, return 0 if successful, -1 if invalid match index
        int getPFList(int matchIndex, PF_List& pfList) override {
            if (matchIndex < 0 || matchIndex >= matchCount) {
                return -1; // Invalid match index
            }
            pfList = pfLists[matchIndex];
            return 0; // Success
        };

        vector<PF_List> getPFLists() override {
            return pfLists; // Return the vector of PF_Lists
        };


        int BanProfession(int round_number, int teamID, int PF_ID);

        int PickProfession(int round_number, int teamID, int PF_ID);

        int AssingProfession(int round_number, int teamID, vector<int> PF_IDs);

        /*Add a team to the room, return 0 if successful, 1 if the number of teams is sufficinet 
                                        2 if the team is already in the room,
            if the number of teams is sufficinet automatically enter the start state
        */
        int AddTeam(int teamID) override;

        /*Remove a team from the room, return 0 if successful, -1 if the team is not in the room*/
        int RemoveTeam(int teamID) override;
};